IdentityManager identityManager = new DefaultIdentityManager();
Please refer to http://docs.jboss.org/picketlink/2/latest/reference/html_single/
PicketLink IDM library provides a comprehensive API and Implementation for managing the lifecycle of Identity (User,Role,Group) along with attributes.
The Implementation is backed by either an LDAP, a Database (via JPA) or a File System.
IdentityManager identityManager = new DefaultIdentityManager();
//Create an LDAP Configuration
LDAPConfigurationBuilder builder = new LDAPConfigurationBuilder();
LDAPConfiguration ldapconfig = (LDAPConfiguration) builder.build();
ldapconfig.setBindDN("uid=admin,ou=system").setBindCredential("secret").setLdapURL(LDAP_URL);
ldapconfig.setUserDNSuffix(USER_DN_SUFFIX).setRoleDNSuffix(ROLES_DN_SUFFIX);
ldapconfig.setGroupDNSuffix(GROUP_DN_SUFFIX);
//Create Identity Configuration
IdentityConfiguration config = new IdentityConfiguration();
config.addStoreConfiguration(ldapconfig);
identityManager.bootstrap(config, new DefaultIdentityStoreInvocationContextFactory(null));
//Injected or configured EntityManagerFactory emf; IdentityConfiguration identityConfig = new IdentityConfiguration(); JPAIdentityStoreConfiguration config = new JPAIdentityStoreConfiguration(); identityConfig.addStoreConfiguration(config); IdentityManager identityManager = new DefaultIdentityManager(); identityManager.bootstrap(identityConfig, new DefaultIdentityStoreInvocationContextFactory(emf));